package com.edu.controller;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class ExceptionController {

    @ExceptionHandler(Throwable.class)
    public ModelAndView exceptionHandler(HttpServletRequest request){

        ModelAndView mv = new ModelAndView();
        mv.addObject("msg","出错啦~");
        mv.setViewName("forward:/error.jsp");
        return mv;
    }

}
